package com.ssy.lingxi.settle.accounts.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 业务对账单行信息DO
 * @author Saske
 * @date 2021/12/7
 * @version 2.0.0
 */
@Entity
@Table(schema = "public",name = "sa_business_reconciliation_row",
indexes = {@Index(name = "sa_business_reconciliation_row_reconciliation_id_idx",columnList = "reconciliation_id"),
            @Index(name = "sa_business_reconciliation_row_settlement_product_id_idx",columnList = "settlementProductId"),
            @Index(name = "sa_business_reconciliation_row_reconciliation_no_idx",columnList = "reconciliationNo")
})
public class BusinessReconciliationRowDO implements Serializable {

    private static final long serialVersionUID = -158124681655248741L;

    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "member_statement_reconciliation_row_seq")
    @SequenceGenerator(sequenceName = "sa_statement_reconciliation_row_seq", name = "statement_reconciliation_row_seq", allocationSize = 1)
    private Long id;

    /**
     * 多对一双向关联对账单
     */
    @JsonBackReference
    @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.REFRESH}, optional = false)
    @JoinColumn(name = "reconciliation_id")
    private BusinessReconciliationDO reconciliation;

    /**
     * * 对账单号
     */
    @Column(name = "reconciliationNo",columnDefinition = "varchar(50)")
    private String reconciliationNo;

    /**
     * 订单id
     */
    @Column(name = "orderId")
    private Long orderId;

    /**
     * 订单编号
     */
    @Column(name = "orderNo",columnDefinition = "varchar(20)")
    private String orderNo;

    /**
     * 订单状态
     */
    @Column(name = "orderStatus",columnDefinition = "varchar(20)")
    private String orderStatus;

    /**
     * 订单类型
     */
    @Column(name = "orderType",columnDefinition = "varchar(20)")
    private Integer orderType;

    /**
     * 单据类型
     * 定义： ApplyAmountRowBillTypeEnum
     */
    @Column
    private Integer billType;

    /**
     * 单据日期
     */
    @Column
    private LocalDateTime billDate;

    /**
     * 单据金额
     */
    @Column
    private BigDecimal billAmount;

    /**
     * 单据摘要
     */
    @Column
    private String billAbstract;

    /**
     * 来源合同id
     */
    @Column
    private Long sourceContractId;

    /**
     * 结算商品明细数据来源ID
     */
    @Column
    private Long settlementProductId;

    /**
     * 预计结算日期
     */
    @Column(name = "settlementDate")
    private LocalDateTime settlementDate;

    /**
     * 发货批次
     */
    @Column(name = "deliveryBatch")
    private String deliveryBatch;

    /**
     * 发货单号
     */
    @Column(name = "deliveryNo")
    private String deliveryNo;

    /**
     * 收货单号
     */
    @Column(name = "receiveNo")
    private String receiveNo;

    /**
     * 物料编码
     */
    @Column(name = "productNo")
    private String productNo;

    /**
     * 物料名称
     */
    @Column(name = "name")
    private String name;

    /**
     * 商品规格
     */
    @Column(name = "spec")
    private String spec;

    /**
     * 商品品类
     */
    @Column(name = "category")
    private String category;

    /**
     * 商品品牌
     */
    @Column(name = "brand")
    private String brand;

    /**
     * 单位
     */
    @Column(name = "unit")
    private String unit;

    /**
     * 税率（百分比的分子部分）
     */
    @Column(name = "taxRate",columnDefinition = "decimal")
    private BigDecimal taxRate;

    /**
     * 单价（含税）
     */
    @Column(name = "price",columnDefinition = "decimal")
    private BigDecimal price;

    /**
     * 待对账数量
     */
    @Column(name = "reconciliationQuantity",columnDefinition = "decimal")
    private BigDecimal reconciliationQuantity;

    /**
     * 待对账金额（含税）
     */
    @Column(name = "reconciliationMoneyAmount",columnDefinition = "decimal")
    private BigDecimal reconciliationMoneyAmount;

    /**
     * 本次对账数量
     */
    @Column(name = "currentQuantity",columnDefinition = "decimal")
    private BigDecimal currentQuantity;

    /**
     * 本次对账金额（含税）
     */
    @Column(name = "currentMoney",columnDefinition = "decimal")
    private BigDecimal currentMoney;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public BusinessReconciliationDO getReconciliation() {
        return reconciliation;
    }

    public void setReconciliation(BusinessReconciliationDO reconciliation) {
        this.reconciliation = reconciliation;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public String getReconciliationNo() {
        return reconciliationNo;
    }

    public void setReconciliationNo(String reconciliationNo) {
        this.reconciliationNo = reconciliationNo;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(String orderStatus) {
        this.orderStatus = orderStatus;
    }

    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public Long getSettlementProductId() {
        return settlementProductId;
    }

    public void setSettlementProductId(Long settlementProductId) {
        this.settlementProductId = settlementProductId;
    }

    public LocalDateTime getSettlementDate() {
        return settlementDate;
    }

    public void setSettlementDate(LocalDateTime settlementDate) {
        this.settlementDate = settlementDate;
    }

    public String getDeliveryBatch() {
        return deliveryBatch;
    }

    public void setDeliveryBatch(String deliveryBatch) {
        this.deliveryBatch = deliveryBatch;
    }

    public String getDeliveryNo() {
        return deliveryNo;
    }

    public void setDeliveryNo(String deliveryNo) {
        this.deliveryNo = deliveryNo;
    }

    public String getReceiveNo() {
        return receiveNo;
    }

    public void setReceiveNo(String receiveNo) {
        this.receiveNo = receiveNo;
    }

    public String getProductNo() {
        return productNo;
    }

    public void setProductNo(String productNo) {
        this.productNo = productNo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public BigDecimal getTaxRate() {
        return taxRate;
    }

    public void setTaxRate(BigDecimal taxRate) {
        this.taxRate = taxRate;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getReconciliationQuantity() {
        return reconciliationQuantity;
    }

    public void setReconciliationQuantity(BigDecimal reconciliationQuantity) {
        this.reconciliationQuantity = reconciliationQuantity;
    }

    public BigDecimal getReconciliationMoneyAmount() {
        return reconciliationMoneyAmount;
    }

    public void setReconciliationMoneyAmount(BigDecimal reconciliationMoneyAmount) {
        this.reconciliationMoneyAmount = reconciliationMoneyAmount;
    }

    public BigDecimal getCurrentQuantity() {
        return currentQuantity;
    }

    public void setCurrentQuantity(BigDecimal currentQuantity) {
        this.currentQuantity = currentQuantity;
    }

    public BigDecimal getCurrentMoney() {
        return currentMoney;
    }

    public void setCurrentMoney(BigDecimal currentMoney) {
        this.currentMoney = currentMoney;
    }

    public LocalDateTime getBillDate() {
        return billDate;
    }

    public void setBillDate(LocalDateTime billDate) {
        this.billDate = billDate;
    }

    public BigDecimal getBillAmount() {
        return billAmount;
    }

    public void setBillAmount(BigDecimal billAmount) {
        this.billAmount = billAmount;
    }

    public String getBillAbstract() {
        return billAbstract;
    }

    public void setBillAbstract(String billAbstract) {
        this.billAbstract = billAbstract;
    }

    public Long getSourceContractId() {
        return sourceContractId;
    }

    public void setSourceContractId(Long sourceContractId) {
        this.sourceContractId = sourceContractId;
    }

    public Integer getBillType() {
        return billType;
    }

    public void setBillType(Integer billType) {
        this.billType = billType;
    }
}
